package com.easy.api.controller;

import com.channel.test.*;
import com.easy.api.annotation.ApiDecrypt;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * @Author liuyuan
 * @Date 2020-04-23 12:53
 * @Version 1.0
 */
@RestController
public class TestController {

    @Resource
    TestInterface testInterface;
    @Resource
    TestFileInterface testFileInterface;

    /**
     * 获取微信token请求测试
     * */
    @RequestMapping("/test")
    public ResultModel test(){
        TestParam testParam = new TestParam();
        testParam.setAppid("wxd21ecc79b39fa803");
        testParam.setSecret("0305adf2e29a86c8f5ac8cb3acb25ea7");
        ResultModel resultModel = testInterface.getToken(testParam);
        return resultModel;
    }
    /**
     * 生成excel 测试
     * */
    @RequestMapping("/test01")
    public void test01(){
        ArrayList<String> strings = new ArrayList<>();
        strings.add("tom");
        strings.add("邱帅飞");
        User user = new User();
        user.setName("测试生成excel");
        user.setTh(strings);
        testFileInterface.test(user);
    }
    /**
     * 解密测试
     * 测试数据:http://localhost:8080/test02?str=x78sLjonO5vT4rEyFrDsp9OxXgiMHtwJK9J2MOwM4KA=
     * */
    @RequestMapping("/test02")
    @ApiDecrypt
    public void test02(String kk,Integer yy){
        System.out.println("--------kk:"+kk+"++++++++yy:"+yy);
    }
}
